package com.eu.ebpm.engine.entity.runtime;

import java.util.Date;

import com.eu.ebpm.engine.entity.BaseEntity;
import com.eu.ebpm.engine.entity.deploy.Deploy;
import com.eu.ebpm.engine.init.EbpmCache;
import com.eu.ebpm.engine.service.Task;

public class Execution extends BaseEntity {

	//基本信息//
	private String name;
	
	private String desc;
	
	private String user;
	
	private String businessKey;
	
	private String businessDesc;
	
	private String businessType;
	
	private Long deployId;
	
	private Date createTime;
	
	private Long parentId;
	
	private Long rootId;
	//基本信息//
	
	private Deploy deploy;
	
	private Task task;
	
	public Execution(){}
	
	public Execution(String user, String name, String desc, String businessKey, String businessDesc, String businessType, Long parentId, Long deployId, Date createTime) {
		this.initId();
		this.rootId = this.id;
		this.user = user;
		this.name = name;
		this.desc = desc;
		this.businessKey = businessKey;
		this.businessDesc = businessDesc;
		this.businessType = businessType;
		this.parentId = parentId;
		this.deployId = deployId;
		this.createTime = createTime;
	}

	public Execution(String name, String desc, String businessKey, String businessDesc, Long deployId, Date createTime, Long parentId, Long rootId) {
		this.initId();
		this.name = name;
		this.desc = desc;
		this.businessKey = businessKey;
		this.businessDesc = businessDesc;
		this.deployId = deployId;
		this.createTime = createTime;
		this.parentId = parentId;
		this.rootId = rootId;
	}

	public String getBusinessType() {
		return businessType;
	}

	public void setBusinessType(String businessType) {
		this.businessType = businessType;
	}

	public String getBusinessDesc() {
		return businessDesc;
	}

	public void setBusinessDesc(String businessDesc) {
		this.businessDesc = businessDesc;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getBusinessKey() {
		return businessKey;
	}

	public void setBusinessKey(String businessKey) {
		this.businessKey = businessKey;
	}

	public Deploy getDeploy() {
		if(deploy == null)
			deploy = EbpmCache.getDeploy(deployId);
		return deploy;
	}

	public void setDeploy(Deploy deploy) {
		this.deploy = deploy;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public Task getTask() {
		return task;
	}

	public void setTask(Task task) {
		this.task = task;
	}

	public Long getRootId() {
		return rootId;
	}

	public void setRootId(Long rootId) {
		this.rootId = rootId;
	}

	public Long getDeployId() {
		return deployId;
	}

	public void setDeployId(Long deployId) {
		this.deployId = deployId;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}
	
}
